#ifndef __ORIENTATOR_HH__
#define __ORIENTATOR_HH__

/**
 * @file Orientator
 * @author olgierdh@gmail.com
 */

#include "common/nvMath.hh"

/**
 * @class Orientator
 */
class Orientator
{
public: // ctor & dtor
   Orientator( void )
   {
   }
   
public: // Position
   void setPosition( const nv::vec3f& aPosition )
   {
      mPosition = aPosition;
   }
   
   void move( const nv::vec3f& aHeading, float aDistance )
   {
      mPosition += normalize( aHeading ) * aDistance;
   }
   
   const nv::vec3f& getPosition( void ) const
   {
      return mPosition;
   }
   
public: // Orientation
   void setOrientation( const nv::quaternionf& aOrientation )
   {
      mOrientation = aOrientation;
   }
   
   void rotate( const nv::vec3f& aAxis, float aAngle )
   {
      nv::quaternionf lTmp( aAxis, aAngle );
      mOrientation = lTmp * mOrientation;
   }
   
   const nv::quaternionf& getOrientation( void ) const
   {
      return mOrientation;
   }
   
public: // Scale
   void setScale( const nv::vec3f& aScale )
   {
      mScale = aScale;
   }
   
   const nv::vec3f& getScale( void ) const
   {
      return mScale;
   }
   
public: // set 
   void set( const nv::matrix4f& aIn )
   {
      mOrientation.set_value( aIn );
      mPosition = aIn.get_translation();
      mScale = aIn.get_scale();
   }

public: // Extraction
   void extract2Mat4( nv::matrix4f& aOut )
   {
      mOrientation.set_value( aOut );
      aOut.set_translate( mPosition );
      aOut.set_scale( mScale );
   }
   
private:
   nv::vec3f         mPosition;
   nv::vec3f         mScale;
   nv::quaternionf   mOrientation;
}; 

#endif //__ORIENTATOR_HH__